/*package com.itheima.ex;

import com.alibaba.fastjson.JSON;
import com.itheima.entity.Result;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Component
public class MyException implements AccessDeniedHandler {

    @Override
    public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException, ServletException {
        //如果是异步信息 返回的数据都会返回到前台回调函数中
        Result result = new Result(false,"无权限访问");
        //把Result转成json数据
        String str = JSON.toJSON(result).toString();
        //处理响应中文乱码
        httpServletResponse.setContentType("application/json;charset=utf-8");
        httpServletResponse.getWriter().print(str);
    }
}*/
